home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / lib / midearth.g < prev    next >
Text File  |  1995-05-04  |  15KB  |  539 lines

  1. (game-module "midearth"
  2.   (title "Middle Earth")
  3.   (blurb "Tolkien's Middle Earth")
  4.   (version "2.0.0")
  5.   (variants 
  6.     (see-all false)
  7.     (world-seen false)
  8.   )
  9. )
  10.  
  11.  
  12. ;;;  Units
  13.  
  14. (unit-type hobbit (image-name "hobbit") (possible-sides "good")
  15.     (char "h") (help "cheap, good explorers")
  16.     (notes ("Easily produced, hobbits are good explorers"
  17.         "but not very good fighters.")))
  18. (unit-type dwarf (image-name "dwarf") (possible-sides (or "good" "evil"))
  19.     (char "d") (help "dig and run mines")
  20.     (notes ("Dwarves are irreplaceable in digging,"
  21.         "running and conquering mines.")))
  22. (unit-type elf (image-name "elf") (possible-sides "good")
  23.     (char "e") (help "fast explorers, swim rivers")
  24.     (notes ("Good and fast explorers, elves can swim across rivers.")))
  25. (unit-type orc (image-name "orc") (possible-sides "evil")
  26.     (char "o") (help "cheap, cannon fodder")
  27.     (notes "Orcs are easily produced, but get slaughtered in battle."))
  28. (unit-type man (image-name "swordman") (possible-sides (or "good" "evil"))
  29.     (char "m") (help "the backbone of an army")
  30.     (notes ("Men are the solid core of armies.")))
  31. (unit-type rider (image-name "cavalry") (possible-sides (or "good" "evil"))
  32.     (char "R") (help "fast, can explore and fight")
  33.     (notes ("The fast-moving riders can explore and fight"
  34.         "(best used for shock-effect).")))
  35. (unit-type wizard (image-name "sorceror") (possible-sides "good")
  36.     (char "W")
  37.   )
  38.  
  39. (unit-type ship (image-name "frigate") (possible-sides (or "good" "evil"))
  40.     (char "S") (help "carry troops on sea")
  41.     (notes ("Ships can quickly carry land forces across water and along"
  42.         "rivers, but are no good for fighting (except by themselves).")))
  43.  
  44. (unit-type nazgul (image-name "nazgul") (possible-sides "evil")
  45.     (char "N") (help "fly, great fighters")
  46.     (notes ("Ringwraiths or Nazguls are evil creatures moving very quickly"
  47.         "upon winged steeds.  They are superb fighters,"
  48.         "but are vulnerable to hobbits!")))
  49. (unit-type troll (image-name "troll") (possible-sides "monsters")
  50.     (char "T") (help "hide in forest and mountains")
  51.     (notes "Trolls lurk in forests and mountains,"
  52.        "and are best left to themselves."))
  53. (unit-type dragon (image-name "dragon-3") (possible-sides "monsters")
  54.     (char "D") (help "the nastiest beast, avoid it!")
  55.     (notes ("Dragons fly and can destroy cities."
  56.         "Leave them alones if you can")))
  57.  
  58. (unit-type mine (image-name "mine-2") (possible-sides (or "good" "evil"))
  59.     (char "M") (help "make your gold")
  60.     (notes ("Gold is obtained in quantity only in mines."
  61.         "A lot of gold is needed to produce nazguls."
  62.         "Therefore try to build or capture mines.")))
  63. (unit-type village (image-name "walltown") (possible-sides (or "good" "evil"))
  64.     (char "*") (help "small production center")
  65.     (notes ("Villages are small population centers;"
  66.         "they can produce everything.")))
  67. (unit-type town (image-name "castle") (possible-sides (or "good" "evil"))
  68.     (char "@") (help "large production center")
  69.     (notes ("Towns are larger population centers;"
  70.         "they produce faster then villages.")))
  71. (unit-type ruins (image-name "ruins") (possible-sides (not "monsters"))
  72.     (char "r") (help "hiding place"))
  73. (unit-type the-ring (image-name "ring")
  74.     (char "O"))
  75.  
  76. (define h hobbit)
  77. (define d dwarf)
  78. (define e elf)
  79. (define o orc)
  80. (define m man)
  81. (define R rider)
  82. (define W wizard)
  83. (define S ship)
  84. (define N nazgul)
  85. (define T troll)
  86. (define D dragon)
  87. (define M mine)
  88. (define * village)
  89. (define @ town)
  90. (define r ruins)
  91.  
  92. (add (* @) wrecked-type ruins)
  93. (add (T D N M * @) point-value (1 1 1 10 10 20))
  94. (add the-ring point-value 1000)
  95.  
  96. ;;; Materials
  97.  
  98. (material-type food (help "everybody needs it"))
  99. (material-type gold (help "everybody wants it"))
  100.  
  101.  
  102. ;;; Terrains
  103.  
  104. (terrain-type sea (color "deep sky blue") (image-name "sea") (char ".")
  105.           (help "sea or lake"))
  106. (terrain-type swamp (color "medium aquamarine") (image-name "swamp")
  107.           (char "="))
  108. (terrain-type wasteland (color "yellow") (image-name "desert") (char "~"))
  109. (terrain-type plains (color "green") (image-name "plains") (char "+"))
  110. (terrain-type forest (color "forest green") (image-name "forest") (char "%"))
  111. (terrain-type mountains (color "sienna") (image-name "mountains") (char "^") )
  112. (terrain-type ice (color "azure") (image-name "ice") (char "_")
  113.           (help "any inaccessible terrain"))
  114.  
  115. (terrain-type road (color "gray") (char ">")
  116.           (subtype connection) (subtype-x road-x)
  117.           (help "road or bridge"))
  118. (terrain-type river (color "blue") (char "<")
  119.           (subtype border) (subtype-x river-x))
  120. (terrain-type ford (color "sandy brown") (char "|")
  121.           (subtype border))
  122.  
  123. (set edge-terrain ice)
  124.  
  125. (define land-t* (wasteland plains forest mountains))
  126. (define cell-t* (sea swamp wasteland plains forest mountains ice))
  127. (define land-forces (h d e o m R W))
  128. (define monst (T D))
  129. (define movers (h d e o m R W S N T D))
  130. (define places (M * @ r))
  131. (define makers (* @))
  132.  
  133. ; lots of forests in this period:
  134. ;                                sea swa pla for des mou ice
  135. (add cell-t* alt-percentile-min (  0  40  40  40  40  90  98))
  136. (add cell-t* alt-percentile-max ( 40  90  90  90  90  98 100))
  137. (add cell-t* wet-percentile-min (  0  97  12  47   0   0   0))
  138. (add cell-t* wet-percentile-max (100 100  47  97  12 100 100))
  139.  
  140. ;;; River generation.
  141.  
  142. (add t* elevation-min 0)
  143. (add t* elevation-max 2000)
  144. (add (sea swamp) elevation-min 0)
  145. (add (sea swamp) elevation-max (0 10))
  146. (add mountains elevation-min 2000)
  147. (add mountains elevation-max 9000)
  148. (add ice elevation-min 9000)
  149. (add ice elevation-max 12000)
  150. ;; The elevations above are consistent with 100-km-across cells. */
  151. (area (cell-width 100000))
  152.  
  153. ; Rivers are most likely to start in the mountains or forests.
  154. (add (plains forest mountains ice) river-chance (20.00 30.00 30.00 90.00))
  155. ; Rivers empty into lakes if they don't reach the sea.
  156. (set river-sink-terrain sea)
  157.  
  158. ;;; Road generation.
  159.  
  160. ; (Ice isn't really a liquid, but this keeps rivers out of icefields.)
  161. (add (sea ice) liquid true)
  162.  
  163. (table road-into-chance
  164.   (land-t* land-t* 100)
  165.   ; No roads across ice fields.
  166.   (land-t* ice 0)
  167.   ; Try to get a road back out into the plains.
  168.   (cell-t* plains 100)
  169.   ; Be reluctant to run through hostile terrain.
  170.   (plains (wasteland forest mountains) (10 25 15))
  171.   )
  172.  
  173. (table road-chance 
  174.    (* @ 5)
  175.    (@ * 10)
  176.    (@ @ 60)
  177. )
  178.  
  179. ;;; unit-unit & unit-terrain interactions
  180.  
  181. ;(add u* stack-order (1 4 2 3 5 6 10 7 8 9 11 13 14 12))
  182.  
  183. (table vanishes-on
  184.   (u* (sea ice) true)
  185.   (T (plains wasteland) true)
  186.   (S t* true)
  187.   ((D N S) sea false)
  188. )
  189.  
  190. (table unit-size-as-occupant
  191.   (u* u* 100) ; disables occupancy usually
  192.   (land-forces places 2)
  193.   (land-forces S 2)
  194.   (R places 4)
  195.   (R (r S) (2 4))
  196.   (N places 2)
  197.   (S places 5)
  198.   (u* M 100)
  199.   ((h o d m) M (5 3 2 3))
  200.   )
  201.  
  202. (add places capacity (10 10 20 4))
  203. (add ship capacity 6)
  204.  
  205. (table unit-capacity-x
  206.   (u* the-ring 1)
  207.   (the-ring the-ring 0)
  208.   )
  209.  
  210. ;;; Unit-terrain capacities.
  211.  
  212. ; Limit units to 4 in one cell.  Places cover the entire cell, however. 
  213. (table unit-size-in-terrain
  214.   (u* t* 1)
  215.   (places t* 4)
  216.   )
  217. (add t* capacity 4)
  218. (add road capacity 2)
  219.  
  220. ;;; Unit-material capacities.
  221.  
  222. (table unit-storage-x
  223. ;            h   d  e   o   m   R  W   S  N  T   D    M   *    @ r O
  224.   (u* food ( 6  12  8  10  12  18  6 100 12 12  20    0 200  500 0 0))
  225.   (u* gold (50 200 50 100 100 100  0 200 50  0 900 5000 800 2000 0 0))
  226. )
  227.  
  228. ;;; Initial set-up
  229.  
  230. ;  bad placement of monsters, but better then nothing
  231. (add (@ T D) start-with (1 3 1)) 
  232.  
  233. (table independent-density
  234. ;                     M  *  @  r
  235.   (places wasteland (15 10  0 30))
  236.   (places plains    ( 5 80 50 50))
  237.   (places forest    (15 20  0 30))
  238.   (places mountains (30 20  0 30))
  239. )
  240.  
  241. (table favored-terrain
  242.   (u* t* 0)
  243.   (M (plains forest mountains wasteland) (20 20 100 20))
  244.   (* (plains forest mountains) (100 40 20))
  245.   (@ (plains forest) (100 20))
  246.   (r (plains forest mountains) (100 40 20))
  247.   (T (forest mountains) 100)
  248.   (D (plains forest mountains wasteland) (20 40 40 100))
  249. )
  250.  
  251. (set country-radius-min 7)
  252. (set country-separation-min 20)
  253.  
  254. (add (* @ r) see-always true)
  255.  
  256. ;;; Repair.
  257.  
  258. (add (m R S N D T) hp-recovery 0.25)
  259.  
  260. (table acp-to-repair
  261.   ((* @) u* 1)
  262. )
  263.  
  264. (table hp-per-repair
  265.   ((* @) u* 1)
  266. )
  267.  
  268. (table acp-to-attack
  269.   (movers u* 2)
  270. )
  271.  
  272. ;;; Production.
  273.  
  274. (table base-production
  275.   (land-forces food 2)
  276.   (rider food 3)
  277.   (monst food 3)
  278.   (makers food (10 20))
  279.   (makers gold (1 2))
  280.   (mine gold 20)
  281.   )
  282.  
  283. (table productivity
  284.   (u* t* 0)
  285.   (u* plains 100)
  286.   (u* forest 50)
  287.   (monst t* 100)
  288.   (monst sea 0)
  289.   (makers (wasteland mountains) 25)
  290.   (mine t* 100)
  291. )
  292. (table productivity-max (u* m* 999)) ; hack
  293. (table productivity-min (u* m*   0)) ; hack
  294.  
  295. (table base-consumption
  296.   (u* food 1)
  297.   ((R T D N *) food 2)
  298.   (@ food 4)
  299.   ((r M) food 0)
  300. )
  301.  
  302. ; unrealistic, but otherwise mining is impossible:
  303. (table consumption-as-occupant (u* food 0))
  304.  
  305. (table unit-initial-supply (u* food 999))
  306.  
  307. (table hp-per-starve
  308.   (u* food 0.50)
  309.   ((d D) food 0.25)
  310. )
  311. ;                         h  d  e  o  m  R  W  S  N  T  D
  312. (add movers acp-per-turn (2  2  4  2  2  4  4  4  9  1  5))
  313. #|;                         h  d  e  o  m  R  S  N  T  D
  314.   (add movers acp-per-turn (2  2  3  2  2  4  4  9  1  5))
  315.   (add movers acp-min     (-2 -2 -3 -2 -2 -4 -4 -9 -1 -5))|#
  316. ; until acp-min fixed
  317.  
  318. (add makers acp-per-turn (1 2))
  319.  
  320. (add makers speed 0)
  321.  
  322. (table mp-to-enter-unit
  323.   (u* u* 0)
  324. )
  325. (table mp-to-enter-terrain
  326.   (u* t* 99)
  327.   (land-forces land-t* 2)
  328.   (land-forces ford #|2|# 0) ; until acp-min fixed
  329.   (R ford #|4|# 2)
  330.   (h swamp 2)
  331.   (e (swamp mountains) 3)
  332.   (e (river ford) #|(3 1)|# (2 0))
  333.   (R (plains wasteland forest mountains) (1 2 4 4))
  334.   (land-forces road 0)
  335.   (S sea 1)
  336.   ((N D) t* 1)
  337.   ((N D) ice 99)
  338.   (T (forest mountains) 1)
  339. )
  340.  
  341. (table mp-to-traverse
  342.   (movers (ford river) 99)
  343.   (S river 2)
  344.   ((N D) river 0)
  345.   ((N D) ford 0)
  346.   (movers road 1)
  347.   (S road 99)
  348. )
  349.  
  350. (table can-enter-independent
  351.   (movers ruins true)
  352.   )
  353.  
  354. ;;; Construction parameters.
  355.  
  356. (add ( h  d  o  e  m  R  S  N  M) cp
  357.      (16 24 16 24 24 40 40 50 80))
  358.  
  359. (table acp-to-create
  360.   (d M 1)
  361.   ((* @) movers 1)
  362.   (u* (W N) 0)
  363.   )
  364. (table acp-to-build
  365.   (d M 1)
  366.   ((* @) movers 1)
  367.   (u* (W N) 0)
  368.   )
  369. (table cp-per-build
  370.   (d M 1)
  371.   ((* @) movers 1)
  372.   (u* (W N) 0)
  373.   )
  374. (table cp-on-creation
  375.   ((* @) movers 1)
  376.   (d M 1)
  377.   (u* (W N) 0)
  378. )
  379.  
  380. (table consumption-on-creation
  381.   ((R S N) gold (20 100 500))
  382. )
  383.  
  384. ;;; Combat parameters
  385.  
  386. ;               h d e o m R S N W T D  M  *  @ r O
  387. (add u* hp-max (1 1 1 1 2 2 3 4 4 4 4 20 20 40 1 1))
  388.  
  389. (table hit-chance
  390. ;             h  d  e  o  m  R  W  S  N  T  D 
  391.   (h movers (30 20 20 40 20 20  0  0 50 20 10))
  392.   (d movers (50 50 40 60 40 40  0 10 10 30 15))
  393.   (e movers (50 40 30 70 40 30  0 10 10 40 30))
  394.   (o movers (30 20 10 40 30 20  0 10 10 20 10))
  395.   (m movers (50 40 40 40 50 50  0 15 20 25 25))
  396.   (R movers (50 40 30 40 50 60  0 20 30 50 25))
  397.   (W movers (50 40 30 90 50 60  0 20 70 50 25))
  398.   (N movers (70 90 60 90 80 70  0 50 50 60 60))
  399.   (T movers (30 50 20 60 50 50  0 30  0 50 30))
  400.   (D movers (40 50 30 70 50 50  0 50 20 40 50))
  401.   (S movers 0)
  402.   (S S 40)
  403.   (u* places 100)
  404.   (places u* 0)
  405.   (D places 50)
  406. )
  407.  
  408. (table damage
  409.   (u* u* 1)
  410.   (u* places 0)
  411.   ((T N D) u* 2)
  412.   ((T N D) r 0)
  413.   (h N 2)
  414.   (D (M * @) 5)
  415. )
  416.  
  417. (table capture-chance
  418.   (h (M * @) (20 30 20))
  419.   (d (M * @) (50 30 20))
  420.   (e (M * @) ( 0 50 35))
  421.   (o (M * @) (30 20 15))
  422.   (m (M * @) (40 50 35))
  423.   (R (M * @) ( 0 30 20))
  424.   ((h d e o m R S) r 80)
  425.   ;; Anyone can take possession of the ring.
  426.   (movers the-ring 100)
  427.   )
  428. (table acp-to-capture
  429.   ((h d e o m R) (M * @ r) 1)
  430.   (S r 1)
  431.   )
  432.  
  433. ; try these for now.  Actually SEEING a N should be enough to flee...
  434. (table withdraw-chance-per-attack
  435.   (u* orc 50)
  436.   (N u* 75)
  437.   (N h 25)
  438.   (N (N e) 0)
  439.   )
  440.  
  441. ; (table can-enter-independent (movers r true)) ; not working
  442.  
  443. ;;; Vision
  444.  
  445. (add u* see-occupants false)
  446.  
  447. (table visibility
  448.    (u* t* 100)
  449.    (M t* 10)
  450.    (movers mountains 50)
  451.    (movers forest 25)
  452. ;              ~  +  %  ^
  453.    (h land-t* (50 50 25 25))
  454.    (e land-t* (50 50 15 25))
  455.    ((R T D) t* 100)
  456.    (N t* 50)
  457. )
  458.  
  459. ;;; Misc stuff
  460.  
  461. (table ferry-on-entry
  462.    (u* u* over-own)
  463.    (S movers over-border)
  464. )
  465. (table ferry-on-departure
  466.    (u* u* over-own)
  467.    (S movers over-border)
  468. )
  469.  
  470. (add u* acp-to-disband 1)
  471. (add places acp-to-disband 0)
  472.  
  473. (include "town-names")
  474. (add (* @) namer "random-town-names")  ;  for now
  475.  
  476. (scorekeeper
  477.   (title "")
  478.   (do last-side-wins)
  479.   )
  480.  
  481. ;;; Players and sides
  482.  
  483. #| monster side broken again :-(
  484. (set sides-min 3)
  485.  
  486. ; monster always played by ai
  487. (player 1 (ai-type-name "mplayer"))
  488. (side 1 (name "monsters") (noun "") (plural-noun "") (class "monsters")
  489.         (color "red") (emblem-name "none") (player 1))
  490. |#
  491.  
  492. (set side-library '(
  493.  
  494.   (99 (name "Mordor") (noun "Sauron's slave") (adjective "Mordorian")
  495.       (color "black,red") (class "evil") (emblem-name "evil-eye"))
  496.   (99 (name "The Shire") (plural-noun "Shire folk") (adjective "Shire's")
  497.       (color "gray,black") (class "good") (emblem-name "feather"))
  498.   (99 (noun "Dunadan") (adjective "Dunadan") (plural-noun "Dunedain") ;
  499.       (class "good") (emblem-name "seven-stars"))
  500.  
  501.   (9 (noun "Corsair") (adjective "corsair") (class "evil")
  502.      (emblem-name "pirate"))
  503.   (9 (name "Gondor") (adjective "Gondorian") (class "good")
  504.      (emblem-name "tree-and-crown"))
  505.  
  506.   ((name "Numenor") (adjective "Numenorean") (class "good")
  507.    (emblem-name "star"))
  508.   ((name "Rhovanion") (adjective "Rhovanian") (class "evil"))    
  509.   ((name "Arnor") (adjective "Arnorian") (class "good"))
  510.   ((name "Rohan") (plural-noun "Rohirrim") (class "good"))
  511.   ((name "Lindon") (adjective "Lindonian") (class "good") (emblem-name "swan"))
  512.   ((noun "Southron") (class "evil"))
  513.   ((noun "Easterling") (class "evil"))
  514.   ((noun "Sindar") (adjective "Sindarin") (class "good") (emblem-name "star"))
  515.   ((name "Bree") (noun "Breelander") (class "good"))
  516.   ((noun "Variag") (class "evil"))        
  517.   ((name "Harad") (noun "Haradrim") (class "evil"))
  518. ))
  519.  
  520. (game-module (notes
  521.   "Period under construction."
  522.   ""
  523.   "This period tries to reproduce Tolkien's Middle Earth."
  524.   "Wizards and RINGS are not implemented (for the moment)."
  525.   ""
  526.   "Human players should not get \"monsters\" sides;"
  527.   "dragons are too powerful."
  528.   ""
  529.   "Fords need work."
  530.   ""
  531.   "Please send comments, suggestions, and fixes to the author:"
  532.   "Massimo Campostrini (campo@sunthpi1.difi.unipi.it)"
  533.   "Dipartimento di Fisica,  Piazza Torricelli 2,"
  534.   "I-56126 Pisa,  Italy"
  535. ))
  536.  
  537. (game-module (instructions ("Welcome to Middle Earth."
  538.               "Explore, capture towns, and stay clear of dragons.")))
  539.